package com.zhang.single;


import java.lang.reflect.Constructor;

//enum 本身也是一个Class类
public enum EnumSingle {
    INSTANCE;
    public EnumSingle getInstance(){
        return INSTANCE;
    }
}
class TestDemo{
    public static void main(String []args) throws Exception {
        EnumSingle instance1 = EnumSingle.INSTANCE;
        Constructor<EnumSingle> declaredConstructor=EnumSingle.class.getDeclaredConstructor(null);

        declaredConstructor.setAccessible(true);
        EnumSingle instance2 = declaredConstructor.newInstance();
        System.out.println(instance2);
        System.out.println(instance1);
    }
}